import { fetchUserData } from './user'

export const saveToLocalStore = (key: string, value: string) => {
    const userInfo = fetchUserData();
    const k = userInfo?.customerId ? `${key}_${userInfo?.customerId}` : key
    localStorage.setItem(k, value)
}

export const dataFromLocalStore = (key: string): string | null => {
    const userInfo = fetchUserData();
    const k = userInfo?.customerId ? `${key}_${userInfo?.customerId}` : key
    return window.localStorage.getItem(k)
}

export const removeFromLocalStore = (key: string) => {
    const userInfo = fetchUserData();
    const k = userInfo?.customerId ? `${key}_${userInfo?.customerId}` : key
    return window.localStorage.removeItem(k)
}